| Total Complexity | 2 |
| Total Lines | 14 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { Injectable } from "@angular/core"; |
||
| 3 | |||
| 4 | @Injectable({ |
||
| 5 | providedIn: "root", |
||
| 6 | }) |
||
| 7 | export class UserFactory { |
||
| 8 | public set factoryFunction(factoryFunction: () => any) { |
||
| 9 | this.privFactoryFunction = factoryFunction; |
||
| 10 | } |
||
| 11 | |||
| 12 | public create() { |
||
| 13 | return this.privFactoryFunction(); |
||
| 14 | } |
||
| 15 | private privFactoryFunction: () => any = () => { |
||
| 16 | return new UserModel(); |
||
| 17 | }; |
||
| 19 |